<?php


namespace Part24_IntermediaryModel\Code2;


require_once '../../autoload.php';

$h1 = new ConcreteHandle1();
$h2 = new ConcreteHandle2();
$h3 = new ConcreteHandle3();
// 设置职责链的下家
$h1->setSuccessor($h2);
$h2->setSuccessor($h3);

$requests = [2, 5, 14, 22, 18, 3, 27, 20];

foreach ($requests as $request) {
    $h1->handleRequest($request);
}